import axios from '../utils'

const api = {
  campaigns: '/campaigns',
  changeState: '/campaigns/change_state',
  getAllDataByPage: '/campaigns/getAllDataByPage',
  copyCampaigns: '/campaigns/copy',
  archivedCampaigns: '/campaigns/change_archived'
}

export default api


export function changeState(parameter) {
  return axios({
    url: api.changeState,
    method: 'get',
    params: parameter
  })
}

export function getAllDataByPage(parameter) {
  return axios({
    url: api.getAllDataByPage,
    method: 'get',
    params: parameter
  })
}

//复制广告活动
export function copyCampaigns(parameter) {
    return axios({
        url: api.copyCampaigns,
        method: 'get',
        params: parameter
    })
}
//归档广告活动
export function archivedCampaigns(parameter) {
    return axios({
        url: api.archivedCampaigns,
        method: 'get',
        params: parameter
    })
}


export function savaCampaigns(parameter) {
  return axios({
    url: api.campaigns,
    method: 'post',
    data: parameter
  })
}

export function updateCampaigns(parameter) {
  return axios({
    url: api.campaigns,
    method: 'put',
    data: parameter
  })
}

export function getCampaigns(parameter) {
  return axios({
    url: api.campaigns + parameter,
    method: 'get',
  })
}
